﻿package com.dhy.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2016102200736487";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key ="MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC+hztqnw6rhrqxIVWSKqs5CUFSy74lbIPnyENeJelcvq2XBXgDFw+65PMoq4AWPjNdKyRLbRZJ44Tbjl6t4JZZtP+qPJfbyU+R2qRUkrFkONTpMdOXmJVlX9bIN9sTv/JqT9fgEQxVZ4MqYB7CTxMZqZebcfO4gtBBEuzEEplGVYSYDLqG8MsqI08E41DkTuVWCtif/Ow9waUy6IdgVK2nSNFZ2M/uZwlSIPMPrwYuVNa3iCRnwyoQ/NBRtNNh4Zzbh016QgFwZOK7YJQRka3+CRhzhB1cwP+BqGAhEmN1bDB/bnSllijU75jsts4t2dpP1UEj3r1kP7ZsfHins7pnAgMBAAECggEBAIcPI95T/Dk5G3Re1eL0XkXjOqwvg43R27tdaev+Yet9u14X4VgHa/4nN/t3fyfFVfHQmDzjim48WzysMo99afcTaDzMETYbAU26OM0+44LRCpR33q9S2WxwQLfTaHgalAQqrzPFwgF0jDVox8Uj+r0xTChD4enEyU2n1bC0InUJBNsx3FX9vttRDPHojXR/hjdo1h5K++XZYH51BLq+3mC8GiKQ6sTDcaw53DjdoKBBFesJSkp38jWqxVlfxnd7FJJGOH8sz/czHeTRyqBx0GRKR61LRmAPQt3kssnvDCg3ylMXFMFL4ykx9c0hAiIlTArsvLMRkrGyW0Lufk8wqfECgYEA+GPPSEqva2dLROh+vhDKkSr1jM9cJkFYN+f8c5JseQoAuF9rz+7kp7KPUe9vDCY1bzD4fSecrxZenncCCD8uBwiS6O1a6t2kHsqxIn+FfctdzTBzPcw7fl/g57lhQLw6/uvO72MNutEeySKQdUal0Gn4aCpQNbKfat4rbLQtO+8CgYEAxF2ZAVwT8OmAGK+zmkxUH+9VNY60p3QQkCta+X49JhXgK7iek2vnlZKFy8MS/IomPIbYtwGgj6gJwlJQRGL2LGrzfu6vLwSEJ7rLbcn8zGWubfxd5/BI1Dqg1/sPNFPxawB/LjE+N7sVEHzT8TY0XNzCtqVKA591NYBdjHI6UQkCgYEA6t3ttSyxnHwqhvjUR0I3WHbngoLcXmvxT8OzSVDN8tGLhsrrdc0tNoi3zkD5nuJOKlqCzEz1cfVT+MENEeEz04C+8TLmgiibtGXygm1UO3NdudSzU17XbpKYZmQ62mxh2IP+wwrFg72TP5rIP6xSw7RAJ7bC61OAPBvhscLY9s8CgYAkhwCyRw2Sj+z7KpvvROmVMzEXkF88kxONrfLzXC9FyWX03BfrdnQS17m5yKTcg1pPggoIKO5UKr79/c/emMYQRyjaYM4HogBvX4j9+EflQbjrzrktLv5tNCa9Zn9SjZbn/6So1BItzchCU+YdBadB6vLxhNe6ysvD0wgT2x/L+QKBgHVDdhpE4tOnE2e3IY3Z82FcqTT0PDxD43TTHdrY7tCnpdigY8x2b/BwhNqWbPnYesS1RfazF86SmGENizrz2chSpo8Ei8xKDS/rCMm5lLeooLWU/KQoGY2WiL+fBWNO0F2nsYq+nHFW7tgAG78yr2UKbmMjGLiDSiRjVH4nFw3/";
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDIgHnOn7LLILlKETd6BFRJ0GqgS2Y3mn1wMQmyh9zEyWlz5p1zrahRahbXAfCfSqshSNfqOmAQzSHRVjCqjsAw1jyqrXaPdKBmr90DIpIxmIyKXv4GGAkPyJ/6FTFY99uhpiq0qadD/uSzQsefWo0aTvP/65zi3eof7TcZ32oWpwIDAQAB";
	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://localhost:8080/JavaWeb项目_第六组/jsp/dhy/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://localhost:8080/JavaWeb项目_第六组/jsp/lsx/travel_Store.jsp";

	// 签名方式
	public static String sign_type = "RSA";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "D:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

